package com.mes.basicdata.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Where;
import org.springframework.context.annotation.Lazy;

/**
 * <p>
 * �����࣬�ǵ������ĸ���
 * </p>
 * 
 * <p>
 * Created on Apr 6, 2008
 * </p>
 * 
 * @author lhy
 * 
 */
/**
 * @time 2017/3/16
 * @author SnowBear
 *	取消实体注解，如果有的话，他的子类不会被识别出来
 */
@Entity()
@Table(name = "B_PART_NUMBER")
@Where(clause="part_number_type like '06%' ")
@BatchSize(size=10)
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
public class Tool extends Resource implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GenericGenerator(name = "toolUid", strategy = "assigned")
	@Column(name="PART_NUMBER",unique = true)
	protected String toolUid;
	
	@Column(name="PART_NAME")
	protected String toolName;
	
	@Column(name="BARCODE",precision=10,scale=0)
	protected String barcode;
	
	@Column(name="UOM",length=50)
	protected String uom;
	
	@Column(name="DRAWINGID")
	protected String drawingId;
	
	@Column(name="VERSIONID",length=50)
	protected String versionId;
	
	// 工具规格
	@Column(name="PART_DESCRIPTION" ,length=2000)
	protected String toolSpecification;
	
	// 用途
	@Column(name="USAGE")
	protected String usage;
	
	@Column(name="PART_NUMBER_TYPE",length=50)
	protected String toolTypeUid;
	// protected TypesData toolType;
	
	// 工装准备派工等级
	@Column(name="DISPATCHGRADE",precision=10,scale=0)
	protected String dispatchGradeUid;
	// protected TypesData dispatchGrade;
	
	// 工装准备工时(分钟)
	@Transient
	protected String prepairWork;
	
	@Column(name="SAFETY_STOCK_BUCKET_SPEC")
	protected String safetyStockBucketSpecification;
	
	@Column(name="SAFETY_STOCK_QUANTITY",precision=30,scale=0)
	protected Integer safetyStockQuantity;
	
	@Column(name="SAFETY_STOCK_PO_LATE_TOLERANCE",precision=30,scale=0)
	protected Integer safetyStockPoLateTolerance;
	
	@Column(name="PLANGRADE",precision=10,scale=0)
	protected Integer planGrade;
	
	// 订货点库存数量
	@Column(name="ORDER_POINT_STOCK_QUANTITY",precision=10,scale=0)
	protected Integer orderPointStockQuantity;
	
	// 盘点周期
	@Column(name="CHECK_TIME",precision=10,scale=0)
	protected Integer checkTime;
	
	// 借用周期
	@Column(name="BORROW_TIME",precision=10,scale=0)
	protected Integer borrowTime;
	
	// 寿命次数
	@Column(name="LIFE_TIME",precision=10,scale=0)
	protected Integer lifeTime;
	
	// 无效周期
	@Column(name="INVALID_TIME",precision=10,scale=0)
	protected Integer invalidTime;
	
	// 有效周期
	@Column(name="CHECKUP_TIME",precision=10,scale=0)
	protected Integer checkupTime;
	
	// 检验周期
	@Column(name="MAINTENANCE_TIME",precision=10,scale=0)
	protected Integer maintenanceTime;
	
	@Column(name="PREPARE_LEAD_TIME",precision=10,scale=0)
	protected Integer preparedLeadTime;

	// 工具数量，b_operation_resource中的属性
	@Transient
	protected Integer numberOfTools;

	@Transient
	protected String changerId;
	
	//@Column(name="CREATOR" ,length=50)
	@Transient
	protected String creatorId;
	@Override
	public String getUuid() {
		// TODO Auto-generated method stub
		return this.getToolUid();
	}

	@Override
	public void setUuid(String uuid) {
		// TODO Auto-generated method stub
		this.setToolUid(uuid);
	}

	public String getChangerId() {
		return changerId;
	}

	public void setChangerId(String changerId) {
		this.changerId = changerId;
	}

	public String getCreatorId() {
		return creatorId;
	}

	public void setCreatorId(String creatorId) {
		this.creatorId = creatorId;
	}

	public String getToolUid() {
		return toolUid;
	}

	public void setToolUid(String toolUid) {
		this.toolUid = toolUid;
	}
	
	/*@Override
	public String getUuid() {
		// TODO Auto-generated method stub
		return this.getToolUid();
	}

	@Override
	public void setUuid(String uuid) {
		// TODO Auto-generated method stub
		this.setToolUid(uuid);
	}*/

	public String getToolName() {
		return toolName;
	}

	public void setToolName(String toolName) {
		this.toolName = toolName;
	}

	public String getBarcode() {
		return barcode;
	}

	public void setBarcode(String barcode) {
		this.barcode = barcode;
	}

	public String getUom() {
		return uom;
	}

	public void setUom(String uom) {
		this.uom = uom;
	}

	public String getDrawingId() {
		return drawingId;
	}

	public void setDrawingId(String drawingId) {
		this.drawingId = drawingId;
	}

	public String getVersionId() {
		return versionId;
	}

	public void setVersionId(String versionId) {
		this.versionId = versionId;
	}

	public String getToolSpecification() {
		return toolSpecification;
	}

	public void setToolSpecification(String toolSpecification) {
		this.toolSpecification = toolSpecification;
	}

	public String getUsage() {
		return usage;
	}

	public void setUsage(String usage) {
		this.usage = usage;
	}

	public String getToolTypeUid() {
		return toolTypeUid;
	}

	public void setToolTypeUid(String toolTypeUid) {
		this.toolTypeUid = toolTypeUid;
	}

	public String getDispatchGradeUid() {
		return dispatchGradeUid;
	}

	public void setDispatchGradeUid(String dispatchGradeUid) {
		this.dispatchGradeUid = dispatchGradeUid;
	}

	public String getPrepairWork() {
		return prepairWork;
	}

	public void setPrepairWork(String prepairWork) {
		this.prepairWork = prepairWork;
	}

	public String getSafetyStockBucketSpecification() {
		return safetyStockBucketSpecification;
	}

	public void setSafetyStockBucketSpecification(
			String safetyStockBucketSpecification) {
		this.safetyStockBucketSpecification = safetyStockBucketSpecification;
	}

	public Integer getSafetyStockQuantity() {
		return safetyStockQuantity;
	}

	public void setSafetyStockQuantity(Integer safetyStockQuantity) {
		this.safetyStockQuantity = safetyStockQuantity;
	}

	public Integer getSafetyStockPoLateTolerance() {
		return safetyStockPoLateTolerance;
	}

	public void setSafetyStockPoLateTolerance(Integer safetyStockPoLateTolerance) {
		this.safetyStockPoLateTolerance = safetyStockPoLateTolerance;
	}

	public Integer getPlanGrade() {
		return planGrade;
	}

	public void setPlanGrade(Integer planGrade) {
		this.planGrade = planGrade;
	}

	public Integer getOrderPointStockQuantity() {
		return orderPointStockQuantity;
	}

	public void setOrderPointStockQuantity(Integer orderPointStockQuantity) {
		this.orderPointStockQuantity = orderPointStockQuantity;
	}

	public Integer getCheckTime() {
		return checkTime;
	}

	public void setCheckTime(Integer checkTime) {
		this.checkTime = checkTime;
	}

	public Integer getBorrowTime() {
		return borrowTime;
	}

	public void setBorrowTime(Integer borrowTime) {
		this.borrowTime = borrowTime;
	}

	public Integer getLifeTime() {
		return lifeTime;
	}

	public void setLifeTime(Integer lifeTime) {
		this.lifeTime = lifeTime;
	}

	public Integer getInvalidTime() {
		return invalidTime;
	}

	public void setInvalidTime(Integer invalidTime) {
		this.invalidTime = invalidTime;
	}

	public Integer getCheckupTime() {
		return checkupTime;
	}

	public void setCheckupTime(Integer checkupTime) {
		this.checkupTime = checkupTime;
	}

	public Integer getMaintenanceTime() {
		return maintenanceTime;
	}

	public void setMaintenanceTime(Integer maintenanceTime) {
		this.maintenanceTime = maintenanceTime;
	}

	public Integer getPreparedLeadTime() {
		return preparedLeadTime;
	}

	public void setPreparedLeadTime(Integer preparedLeadTime) {
		this.preparedLeadTime = preparedLeadTime;
	}

	public Integer getNumberOfTools() {
		return numberOfTools;
	}

	public void setNumberOfTools(Integer numberOfTools) {
		this.numberOfTools = numberOfTools;
	}

	// operation_resource中代表关联关系的属性就不要了，反正中间表也要组合出来？
	// protected String routingUid;
	// protected Routing routing;
	// protected String operationUid;
	// protected Operation operation;
}